package com.atzzy.ysmall.ysmall_mapper;

import com.atzzy.ysmall.ysmall_beans.Orders;
import com.atzzy.ysmall.ysmall_beans.OrdersVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @Author JAVAZeng
 * @Date 2022/4/6 15:10
 * @Version 1.0
 */
@Mapper
@Repository
public interface OrdersMapper {
    int insertOrder(Orders orders);

    int updateStatus(@Param("orderId") String orderId, @Param("status")String status);

    Orders getOrderById(String orderId);

    List<Orders> selectOrdersLessThan(@Param("status") String status, @Param("nowTime") Date nowTime);

    int updateStatusAndCloseTypeInt(@Param("orderId") String orderId,@Param("status") String status,@Param("closeType") int closeType);

    List<OrdersVo> selectOrders(@Param("userId") String userId, @Param("status")String status, @Param("start") int start, @Param("limit") int limit);

    int selectCountByUserId(@Param("userId") String userId);

    int selectCountByStatusAndUserId(@Param("userId") String userId,@Param("status") String status);
}
